﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="user_view_vue.aspx.cs" Inherits="Template.Web.Admin.user_view" %>

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title></title>
    <!-- Bootstrap core CSS -->
    <link href="../css/bootstrap.min.css" rel="stylesheet" />
    <link href="../css/bootstrap-reset.css" rel="stylesheet" />
    <!--external css-->
    <link href="../assets/font-awesome/css/font-awesome.css" rel="stylesheet" />
    <!-- Custom styles for this template -->
    <link href="../css/style.css" rel="stylesheet" />
    <link href="../css/style-responsive.css" rel="stylesheet" />
    <link href="../assets/toastr-master/toastr.css" rel="stylesheet" />
    <link rel="stylesheet" href="/scripts/blockui/blockUI.css" />
    <!-- HTML5 shim and Respond.js IE8 support of HTML5 tooltipss and media queries -->
    <!--[if lt IE 9]><script src="../js/html5shiv.js"></script><script src="../js/respond.min.js"></script><![endif]-->
</head>
<body>
    <section class="wrapper site-min-height">
        <!-- page start-->
        <div class="col-xs-12">
            <section class="panel panel-primary">
                <header class="panel-heading"><i class="fa fa-search"></i>用户信息详情</header>
                <div class="panel-body">
                    <form class="form-horizontal" role="form" id="myForm">
                        <div class="form-body">
                            <!--/row-->
                            <div class="row">
                                <div class="col-md-6">
                                    <div class="form-group">
                                        <label class="control-label col-md-3">用户姓名:</label>
                                        <div class="col-md-9">
                                            <p class="form-control-static" id="userName" v-text="model.userName"></p>
                                        </div>
                                    </div>
                                </div>
                                <div class="col-md-6">
                                    <div class="form-group">
                                        <label class="control-label col-md-3">年龄:</label>
                                        <div class="col-md-9">
                                            <p class="form-control-static" id="age">{{model.age}}</p>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <!--/row-->
                            <div class="row">
                                <div class="col-md-6">
                                    <div class="form-group">
                                        <label class="control-label col-md-3">邮箱:</label>
                                        <div class="col-md-9">
                                            <p class="form-control-static" id="email">{{model.email}}</p>
                                        </div>
                                    </div>
                                </div>
                                <div class="col-md-6">
                                    <div class="form-group">
                                        <label class="control-label col-md-3">手机号码:</label>
                                        <div class="col-md-9">
                                            <p class="form-control-static" id="mobile">{{model.mobile}}</p>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <!--/row-->
                            <div class="row">
                                <div class="col-md-6">
                                    <div class="form-group">
                                        <label class="control-label col-md-3">身份证号:</label>
                                        <div class="col-md-9">
                                            <p class="form-control-static" id="idCard">{{model.idCard}}</p>
                                        </div>
                                    </div>
                                </div>
                                <div class="col-md-6">
                                    <div class="form-group">
                                        <label class="control-label col-md-3">头像:</label>
                                        <div class="col-md-9">
                                            <p class="form-control-static" id="head">{{model.head}}</p>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <!--/row-->
                            <div class="row">
                                <div class="col-md-6">
                                    <div class="form-group">
                                        <label class="control-label col-md-3">生日:</label>
                                        <div class="col-md-9">
                                            <p class="form-control-static" id="birthday">{{model.birthday}}</p>
                                        </div>
                                    </div>
                                </div>
                                <div class="col-md-6">
                                    <div class="form-group">
                                        <label class="control-label col-md-3">备注:</label>
                                        <div class="col-md-9">
                                            <p class="form-control-static" id="remark">{{model.remark}}</p>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <!--/row-->
                            <div class="row"></div>
                        </div>
                        <div class="form-actions">
                            <div class="row">
                                <div class="col-md-offset-4 col-md-8">
                                    <button id="btnReturn" type="button" class="btn btn-warning" v-on:click="jumpToList"><i class="fa fa-reply"></i>返回</button>
                                </div>
                            </div>
                        </div>
                    </form>
                </div>
            </section>
        </div>
        <!-- page end-->
    </section>
    <!-- js placed at the end of the document so the pages load faster -->
    <script src="/js/jquery.js"></script>
    <script src="/js/bootstrap.min.js"></script>
    <script src="/assets/toastr-master/toastr.js"></script>
    <!-- 按需加载 -->
    <script type="text/javascript" src="/scripts/vue/vue.js"></script>
    <script src="/scripts/blockui/jquery.blockUI.js"></script>
    <script type="text/javascript" src="/scripts/util/myUtil2.js"></script>

    <script>
        $(document).ready(function () {

            var vm = new Vue({

                // 对象
                el: '#myForm',

                // 原始数据
                data: {
                    model: {},
                    id: myUtil.getUrlParam('id'),
                    handlerUrl: 'handler/userHandler.ashx',
                    listUrl: 'user_list_vue.aspx?state=has',
                    formName: '#myForm'
                },

                // 生命周期-创建成功后
                created: function () {
                    this.getModel();
                },

                // 方法
                methods: {
                    // 显示等待动画
                    showWaitAnimation: function (bool) {
                        if (bool) {
                            myUtil.blockUI({
                                target: this.formName,
                                message: '加载中，请稍等...'
                            });
                        } else {
                            myUtil.unblockUI(this.formName);
                        }
                    },

                    // 获取数据
                    getModel: function () {
                        var self = this;
                        self.showWaitAnimation(true);
                        $.when($.ajax({
                            url: self.handlerUrl,
                            type: 'post',
                            data: {
                                action: 'detail',
                                id: self.id
                            },
                            dataType: 'json'
                        })).done(function (responseData) {
                            self.model = responseData;
                        }).fail(function () {
                            toastr.warning('数据获取失败！');
                        }).always(function () {
                            self.showWaitAnimation(false);
                        });
                    },

                    // 返回跳转到列表页
                    jumpToList: function () {
                        window.self.location.href = this.listUrl;
                    }

                }
            });
        });
    </script>
</body>
</html>

